Skip to content

Mark generated constructors as #[inline] - #258

Merged
greyblake merged 1 commit into
greyblake:masterfrom
ChrisJr404:inline-constructors
Sep 1, 2026
Merged

Mark generated constructors as #[inline]#258
greyblake merged 1 commit into
greyblake:masterfrom
ChrisJr404:inline-constructors

Conversation

@ChrisJr404

Copy link
Copy Markdown
Contributor

Closes #237. into_inner already gets #[inline], but new, try_new and new_unchecked didn't, so they couldn't be inlined across crate boundaries (which is exactly the workspace case from that issue). This marks all three the same way.

I added a few unit tests that render the generated code and assert the attribute is present.

The into_inner method is already inlined, but new, try_new and
new_unchecked were not, so they could not be inlined across crate
boundaries. Mark them the same way. Closes greyblake#237.
@greyblake

Copy link
Copy Markdown
Owner

Thanks!

@greyblake
greyblake merged commit 2ff468e into greyblake:master Sep 1, 2026
5 of 6 checks passed
@greyblake

Copy link
Copy Markdown
Owner

Released in nutype-0.8.0-beta.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is there a way to add #[inline] to the generated new and try_new methods?

2 participants